const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  configureWebpack: {
    resolve: {
      fallback: {
        path: require.resolve("path-browserify"),
        crypto: require.resolve("crypto-browserify"),
        stream: require.resolve("stream-browserify"),
        "http": false,
        "https": false,
        "constants": false,
        "os": false,
        "child_process": false,
        "nock":false,
        "tls":false,
        "zlib":false,
        "dns":false
      },
    },
  },
  chainWebpack: config => {
    config
      .plugin('html')
      .tap(args => {
        args[0].title= '继续学习'
        return args
      })
  },

  transpileDependencies: true,
  pluginOptions: { // 第三方插件配置
    electronBuilder: {
      customFileProtocol: "./",
      nodeIntegration:true,
      builderOptions: {
        "buildDependenciesFromSource": true,
        "nodeGypRebuild": false,
        "npmRebuild": false,
        "productName": "继续学习",
        "appId": "krokodil.run",
        "directories": {
          "output": "build"
        },
        "extraResources": ["src/db/qdjxjy.db"],
        "dmg": {
          "contents": [
            {
              "x": 410,
              "y": 150,
              "type": "link",
              "path": "/Applications"
            },
            {
              "x": 130,
              "y": 150,
              "type": "file"
            }
          ]
        },
        "mac": {
          "icon": "public/icons/icon.icns"
        },
        "win": {
          "icon": "public/icons/icon.ico",
          "target": [
            "portable"
          ]
        },
        "linux": {
          "icon": "build/icons"
        }
      }
    }
  }
})
